package com.itheima.test_demo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Test02 {
    public static void main(String[] args) {
        HashMap<String, String> map = new HashMap<>();
        map.put("name","1");
        map.put("value","5");
        HashMap<String, String> map1 = new HashMap<>();
        map1.put("name","2");
        map1.put("value","3");
        List<Map<String,String>> list=new ArrayList<>();

        list.add(map);
        list.add(map1);

        System.out.println(list);

        for (Map<String,String> map2 : list) {
            String s = map2.get("name");
            System.out.println(s);

            if (s.equals("1")){
                map2.remove("name");
                map2.put("name","男");
            }
            if (s.equals("2")){
                map2.remove("name");
                map2.put("name","女");
            }
        }

        System.out.println(list);


    }
}
